{% extends 'student_management/base.html' %}
{% load custom_filters %}

{% block content %}
<div class="card">
    <div class="card-header">
        <h3>管理成绩 - {{ course.name }}</h3>
    </div>
    <div class="card-body">
        <form method="post">
            {% csrf_token %}
            <table class="table">
                <thead>
                    <tr>
                        <th>学号</th>
                        <th>姓名</th>
                        <th>成绩</th>
                    </tr>
                </thead>
                <tbody>
                    {% for student in students %}
                    <tr>
                        <td>{{ student.student_id }}</td>
                        <td>{{ student.name }}</td>
                        <td>
                            <input type="number" name="score_{{ student.id }}" 
                                   value="{{ scores|get_item:student.id|default:'' }}"
                                   class="form-control" min="0" max="100" step="0.01">
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
            <button type="submit" class="btn btn-primary">保存成绩</button>
            <a href="{% url 'course-list' %}" class="btn btn-secondary">返回</a>
        </form>
    </div>
</div>
{% endblock %} 